const { Role } = require('board-game');

class RunningRole extends Role {
    constructor(server, room, player, team, index) {
        super(server, room, player, team, index);
    }

    over(win, game) {
        let result = super.over(win, game);
        result.lives = game.board.runners.map(runner => ({ role: runner.role.player.name, keep: runner.deadTime ? runner.deadTime - game.board.start : 0 }));
        return result;
    }

    doAnswer({question, answer}) {
        this.game.doAnswer(this, question, answer);
    }
}

module.exports = RunningRole;
